<#import "common/macro/app.ftl" as app>
<#macro head title="${webSiteName}">
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
		<html xmlns="http://www.w3.org/1999/xhtml">
			 <head>
				  <title>${title}</title>
				  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
				  <meta name="author" content="hbin"/>
				  <meta name="keywords" content="" />
				  <meta name="description" content="${webDescription}" />
				  <script src="${basePath}/style/script/jquery.js" type=text/javascript></script>
				  <script src="${basePath}/style/script/jquery.form.js" type=text/javascript></script>
				  <script src="${basePath}/style/script/dialog.js" type=text/javascript></script>
				  <script src="${basePath}/style/script/util.js" type=text/javascript></script>
				  
				  <link href="${basePath}/style/skin/default/css/main.css" rel="stylesheet" type="text/css" />
				  <link href="${basePath}/style/skin/default/css/icon.css" rel="stylesheet" type="text/css" />
				  <link href="${basePath}/style/skin/default/css/form.css" rel="stylesheet" type="text/css" />
				  <script src="${basePath}/widget/jBox/jquery.jBox-2.3.min.js" type=text/javascript></script>
				  <script src="${basePath}/widget/jBox/jquery.jBox-zh-CN.js" type=text/javascript></script>
				  <link type="text/css" rel="stylesheet" href="${basePath}/widget/jBox/skins2/blue/jbox.css"/>
				  <!--框架必需引入-->
				  
				 <script type="text/javascript" src="${basePath}/style/skin/default/js/form-style-min.js"></script>
				  <#nested>
			 </head>
</#macro>

<#macro body>
		 <body style="height:100%;">
		 <span id="basicInfo" style="display:none" userId="${userInfo.userId}" basePath="${basePath}"></span>
		 	<#nested>
		 </body>
		  <script>
		 	if($("#resultFrame").length>0){
		 		$("#resultFrame").height($(window).height()-120-$("#searchForm").height());
			}
		 </script>
	</html>
</#macro>

<#macro common_add>
	<script src="${basePath}/widget/validate/js/jquery.validate.min.js" type="text/javascript"></script>
	<script src="${basePath}/widget/validate/js/jquery.metadata.js" type="text/javascript"></script>
	<link rel="stylesheet" href="${basePath}/widget/validate/css/screen.css" type="text/css"/>
	<script>
	$().ready(function() {
		$("#inputForm").validate({event: "blur"});
	});
	var AddOptions = { 
			dataType:'json',
			success: function(data) { 
				if(data.code=="200")
				{
					$.jBox.tip(data.msg==null?'操作成功':data.msg,'success',{closed:function() {top.submitQuery();parent.$.jBox.close('id-jbox-dialog');}});
				}else if(data.code=="500"){
					$.jBox.tip(data.msg==null?'操作失败':data.msg,'error',{timeout:1500});
				}else{
					$.jBox.tip(data.msg,'error',{timeout:1500});
				}
			 }
			 
	 }; 
		
	 var submitForm=function(){
	 	 if($('#inputForm').valid()){
			$('#inputForm').ajaxSubmit(AddOptions);
	 	 }
	 };
		
	</script>
</#macro>
<#macro common_list>
	<link rel="stylesheet" href="${basePath}/widget/pagination/pager.css" type="text/css"/>
	<script src="${basePath}/style/js/util.js" type="text/javascript"></script>
	<script src="${basePath}/widget/pagination/jquery-pagination.js" type=text/javascript></script>
	
	<script>
			
		var fanYe = function(currentObj){
			$("#pageNo",window.parent.document).val($(currentObj).attr("page"));
			$("#pageSize",window.parent.document).val($("#pageSize").val());
			top.submitQuery();
		};
		
		var goPage = function(){
			$("#pageNo",window.parent.document).val($("#pageNo").val());
			$("#pageSize",window.parent.document).val($("#pageSize").val());
			top.submitQuery();
		};
		
		var deleteObj = function(url,id,tip)
		 {
			var deleteSubmit = function(v){
				if(!v){
					return true;
				}
				 $.ajax({
					 url:url,
					 dataType:'json',
					 data:'id='+id+"&random="+Math.random(),
					 success:function(data){
						if(data.code=="200")
						{
								parent.$.jBox.tip(data.msg==null?'删除成功':data.msg,'success',{top:'20%',closed:function() {top.submitQuery();}});
						}else{
							parent.$.jBox.tip(data.msg==null?'删除失败':data.msg);
							return false;
						}
				 	}
				});
			};
			if(tip){
				parent.$.jBox.confirm(tip+"确认要删除吗 ?","操作提示",  deleteSubmit, {buttons: { '确定': true, '取消': false} });
			}else{
				parent.$.jBox.confirm("确认要删除吗 ?","操作提示",  deleteSubmit, {buttons: { '确定': true, '取消': false} });
			}
			
		 };
		 
		 //批量删除
		 var batchDel = function(url){
		 	if($("input[checkAttr=singleCheckBox]:checked").size()==0){
				$.jBox.tip('请选择要删除的记录','warning',{top:'20px',closed:function() {return;}});
			}else{
				var deleteSubmit = function(v){
					if(!v){
						return true;
					}
					$("#resultForm").attr("action",url);
					$('#resultForm').ajaxSubmit(parentOptions); 
				};
				parent.$.jBox.confirm("确认要批量删除吗?","删除确认",  deleteSubmit, { buttons: { '确定': true, '取消': false} });
			}
		 };
		
		var parentOptions = { 
			dataType:"json",
			success: function(data) { 
				if(data.code=="200")
				{
					$.jBox.tip("操作成功",'success',{top:'20px',closed:function(){top.submitQuery()}});
				}else{
					$.jBox.tip("操作失败",'error',{top:'20px'});
				}
	 			}
		 }; 
		 
		 var options = { 
		   dataType:"json",
		　　success: function(data) { 
		　　		if(data.code=="200")
		　　		{
		　　			$.jBox.tip("操作成功",'success',{top:'20px',closed:function(){submitQuery()}});
				}else{
					$.jBox.tip("操作失败",'error',{top:'20px'});
				}
		 	}
		 }; 
		 
		 $(document).ready(function(){
		 	$(".listTable tr:not(.opttr)").hover(
			  function(){
			    $(this).css("background-color","#FFF4C1");
			  },
			  function(){
			    $(this).css("background-color","");
			  }
			);
		 });
		 
	</script>
</#macro>

